package edu.cuhk.cs.bookstore.model;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Book
{
  private String name;
  private String autor;
  private String isbn;
  private String publisher;
  private Date publishDate;
  private double hkd;
  private String currency = "hkd";
  
public Book(String name, String autor, String isbn, String publisher,
		Date publishDate) {
	super();
	this.name = name;
	this.autor = autor;
	this.isbn = isbn;
	this.publisher = publisher;
	this.publishDate = publishDate;
	this.hkd = Math.random()*20;
}
public String getName() {
	return name;
}
public void setName(String name) {
	this.name = name;
}
public String getAutor() {
	return autor;
}
public void setAutor(String autor) {
	this.autor = autor;
}
public String getIsbn() {
	return isbn;
}
public void setIsbn(String isbn) {
	this.isbn = isbn;
}
public String getPublisher() {
	return publisher;
}
public void setPublisher(String publisher) {
	this.publisher = publisher;
}
public Date getPublishDate() {
	return publishDate;
}
public void setPublishDate(Date publishDate) {
	this.publishDate = publishDate;
}
public double getHkd() {
	return hkd;
}
public void setHkd(double hkd) {
	this.hkd = hkd;
}
public String getHkdText() {
	if(currency.equals("hkd")){
		return "HKD$"+hkd;
	}else{
		return "USD$"+hkd;
	}
	
}
public String getCurrency() {
	return currency;
}
public void setCurrency(String currency) {
	this.currency = currency;
}
public String getPublishDateText() {
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
	if (publishDate != null) {
		return sdf.format(publishDate);
	}
	return null;
}
}